<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script type="text/javascript">
    //let iterable = [10,20,30];
    //let iterable = "wcd";

    //for(let value of iterable){
    //	console.log(value);
    //}
    function* fibonacci() {
      let [prev, curr] = [0, 1];
      while (true) {
        [prev, curr] = [curr, prev + curr];
        yield curr;
      }
    }
    for (let n of fibonacci()) {
      if (n >= 1000) {
        break;
      }
      console.log(n);
    }
  </script>
</head>

<body>

</body>

</html>